package com.example.onlinemallsystem.util;

import java.io.Serializable;

//Json格式的数据响应
public class JsonResult<T> {
    //状态码
    private Integer state;
    //描述信息
    private String message;
    // 数据类型
    private T data;

    public JsonResult() {

    }

    public JsonResult(Integer state) {
        this.state = state;
    }

    public JsonResult(Throwable e) {
        this.message = e.getMessage();
    }

    public JsonResult(Integer state, T data) {
        this.state = state;
        this.data = data;
    }

    public JsonResult(Integer state,String message, T data) {
        this.state = state;
        this.message = message;
        this.data = data;
    }

    public JsonResult(Integer state,String message) {
        this.state = state;
        this.message = message;
    }
    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
